<?php defined('BASEPATH') OR exit('No direct script access allowed');


class Log_model extends Base_model
{
	protected $_table_name = 'log';
    protected $_key_name = 'id';
	
	public function __construct()
    {
        parent::__construct();
		
    }

    public function lists($limit = NULL,$map_arr = NULL)
    {
        $this->select("log.id as id,log.admin_id as admin_id,admin.name as admin_name,uri,ret_data,message,static,method,params,ip,log.ctime as createTime");

        $this->join('admin','admin.id = log.admin_id','left');
        $this->order_by("log.ctime","DESC");
    	if($this->set_limit($limit))
    	{
    		return $this->result_rows();
    	}
    	else
    	{
    		return $this->result();
    	}
    	
    }
	
	

    public function adds($data_arr = NULL)
    {
        if($data_arr == NULL) return false;

        $data_arr["ctime"] = time();
        return $this->insert($data_arr);
    }

}
/* End of file base_model.php */
/* Location: ./system/application/models/base_model.php */
